<template>
  <div id="app" v-cloak>
    <router-view name="xxx" />
    <div v-if="loading">loading</div>
    <nav>
      <router-link to="/home">Home</router-link> |
      <router-link to="/about">About</router-link>
    </nav>
    <!-- <button @click="$router.push('/home')">跳转home</button> -->
    <!-- <keep-alive exclude="HmHome" :max="2"> -->
    <router-view name="default" />
    <!-- </keep-alive> -->
  </div>
</template>
<script>
export default {
  watch: {
    $route: {
      handler (newVal) {
        // console.log('watch执行了:', newVal)
      }
    }
  },
  provide () {
    return {
      showFn: this.showFn
    }
  },
  data () {
    return {
      loading: false
    }
  },
  methods: {
    showFn (bol) {
      this.loading = bol
    }
  },
  created () {
    // console.log(this.$route)
  }
}
</script>

<style lang="scss">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
    &.router-link-active {
      color: #42b983;
    }
  }
}
</style>
